package com.library.librarybackend.domain.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * @author 平
 * @description 角色枚举
 * @since 2025-09-20 20:52
 */
@Getter
public enum RoleEnum {

    ROOT(0, "root"),
    ADMIN(1, "admin"),
    USER(2, "user");

    private final Integer code;
    private final String message;

    RoleEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static Boolean isExist(Integer code) {
        return Arrays.stream(RoleEnum.values())
                .anyMatch(role -> role.code.equals(code));
    }

}
